Unlike my other submission, I'm not very proud of this one. I don't know how I'd make it faster, but by reusing the shell of my ICG solution to try to make something fast, I ended up making this monstrosity, which is bad at both. 

This is my first time ever doing a competition like this, and I don't really know the etiquette. If I'm only allowed to submit one solution, use the other one because this isn't great. I spent a lot of time on it though, so I felt I should submit it.

Enjoy?